################################
# Build BLE adapter
################################
import os

Import('connectivity_env')

target_os = connectivity_env.get('TARGET_OS')

# Source files common to all platforms.
connectivity_env.AppendUnique(CA_SRC=File('caleadapter.c'))

# Check for the existence of the platform-specific SConscript file
# before calling it - some target platforms do not provide one.
# The check has to happen in the source tree because os.path.*
# methods cannot know about SCons's rewriting rules, but the actual
# call to the script should happen normally or the targets will
# not be adjusted properly - scons keeps track of the directory
# an sconscript is invoked in and actions are relative to that path.
target_sconscript = File(target_os + '/SConscript')
if os.path.exists(target_sconscript.srcnode().abspath):
    SConscript(target_sconscript, exports='connectivity_env')
